package com.internetCafes.spms.common;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Sunny on 2017/12/18.
 */
public class CommonConstants extends GenericCommonConstants {

    // 租户联系人角色配置
    public static final String CONF_Tenant_Contact_Role_Type = "tenant_contact_role_type";

    // 租户管理员角色配置
    public static final String CONF_Tenant_Admin_Role_Type = "tenant_admin_role_type";

    // 证书类型配置
    public static final String CONF_Certificate_Type = "conf_certificate_type";

    /**
     * 证书专业标识
     */
    public static final String CONF_CERTIFICATE_TYPE_PROFESSIONAL = "conf_certificate_type_professional";

    /**
     * 证书类别标识
     */
    public static final String CONF_CERTIFICATE_TYPE_CATEGORY = "conf_certificate_type_category";

    // 系统用户类型配置
    public static final String CONF_Sys_User_Type = "sys_user_type";

    // 资质等级
    public static final String CONF_QUALIFICATION_GRADE_TYPE = "qualification_grade_type";

    // 资质证书类型
    public static final String CONF_CONSTRUCTION_GRADE_TYPE = "construction_grade_type";

    // 特殊身份证号
    public static final String COMMON_ID_CARD = "sms";

    /**
     * 资质资料标识
     */
    public static final String ResourceInfo_PIC_Certi = "ResourceInfo_PIC_Certi";

    /**
     * 荣誉证书图片
     */
    public static final String RESOURCE_PIC_ENT_HONOR = "Resource_Pic_Ent_Honor";

    /**
     * ISO证书图片
     */
    public static final String RESOURCE_PIC_ENT_ISO = "Resource_Pic_Ent_Iso";

    /**
     * 资质证书图片
     */
    public static final String RESOURCE_PIC_ENT_QUALI = "Resource_Pic_Ent_Quali";

    /**
     * 其他证书图片
     */
    public static final String RESOURCE_PIC_ENT_OTHER = "Resource_Pic_Ent_Other";

    /**
     * 合同资料标识
     */
    public static final String ResourceInfo_PIC_Constrat = "ResourceInfo_PIC_Constrat";

    /**
     * 缴费证明标识
     */
    public static final String ResourceInfo_PIC_Pay = "ResourceInfo_PIC_Pay";

    /**
     * 企业营业执照标识
     */
    public static final String ResourceInfo_PIC_Org_Certificate = "ResourceInfo_PIC_Org_Certificate";

    /**
     * 企业资质标识
     */
    public static final String ResourceInfo_PIC_Certificate = "ResourceInfo_PIC_Certificate";

    /**
     * 员工资料标识
     */
    public static final String ResourceInfo_PIC_EmployeeInfo = "ResourceInfo_PIC_EmployeeInfo";

    /**
     * 员工资料标识
     */
    public static final String ResourceInfo_PIC_CertificateRenewalInfo = "ResourceInfo_PIC_CertificateRenewalInfo";

    /**
     *
     */
    public static final String ResourceInfo_PIC_ProjectInfo = "ResourceInfo_PIC_ProjectInfo";

    public static final String ResourceInfo_Path_Prefix = "pic";

    /**
     * 当前邮件发件人
     */
    public static final String CURRENT_MAIL_FROM = "CURRENT_MAIL_FROM";

    public static final String ADMIN = "admin";
    public static final String SYSTEM_MANAGER = "系统管理";

    /**
     * 超级管理员ID
     */
    public static final int SUPER_ADMIN = 1;

    /**
     * 管理员ID
     */
    public static final Long SUPER_ADMIN_ID = 1L;

    public static final String DEFAULT_DEPARTMENT = "行政部";

    /**
     * 证书类别专业录入标签
     *
     * @author Zj
     */
    public enum ProfessionModuleTag {

        /**
         * 证书类别
         */
        CATEGORY(1, CONF_CERTIFICATE_TYPE_CATEGORY),
        /**
         * 专业
         */
        PROFESSION(2, CONF_CERTIFICATE_TYPE_PROFESSIONAL);

        private Integer saveTag;
        private String moduleTag;

        ProfessionModuleTag(Integer saveTag, String moduleTag) {
            this.saveTag = saveTag;
            this.moduleTag = moduleTag;
        }

        public Integer getSaveTag() {
            return saveTag;
        }

        public String getModuleTag() {
            return moduleTag;
        }
    }

    /**
     * 菜单类型
     *
     * @author Sunny
     * @email rekeeper2011@hotmail.com
     * @date 2016年11月15日 下午1:24:29
     */
    public enum FunctionType {
        /**
         * 目录
         */
        CATALOG(0),
        /**
         * 菜单
         */
        MENU(1),
        /**
         * 按钮
         */
        BUTTON(2);

        private Integer value;

        private FunctionType(int value) {
            this.value = value;
        }

        public Integer getValue() {
            return value;
        }
    }

    /**
     * 定时任务状态
     *
     * @author Sunny
     * @email rekeeper2011@hotmail.com
     * @date 2016年12月3日 上午12:07:22
     */
    public enum ScheduleStatus {
        /**
         * 正常
         */
        NORMAL(0),
        /**
         * 暂停
         */
        PAUSE(1);

        private int value;

        private ScheduleStatus(int value) {
            this.value = value;
        }

        public int getValue() {
            return value;
        }
    }

    public static class RoleInfoType {
        //租户企业角色
        public static final long TENANT_MANAGER = 1;

        //租户联系人
        public static final long TENANT_CONTACT = 2;


    }

    public static class DeptInfoType {

        /**
         * 最普通
         */
        public static final int COMMON = 0;

        /**
         * 展示
         */
        public static final int BUZZINESS = 1;


        /**
         * The Constant descrMap.
         */
        static final Map<Integer, String> descrMap = new HashMap<>();

        static {
            descrMap.put(COMMON, "普通");
            descrMap.put(BUZZINESS, "展示");
        }

        public static String getDescr(int subType) {
            return descrMap.getOrDefault(subType, "未知");
        }
    }


    public static class CertificateType {

        /**
         * 在职员工证书
         */
        public static final int SELF = 1;

        /**
         * 挂靠证书
         */
        public static final int PartTime = 2;

        /**
         * 非在职员工证书
         */
        public static final int FRIEND = 3;


        /**
         * The Constant descrMap.
         */
        static final Map<Integer, String> descrMap = new HashMap<>();

        static {
            descrMap.put(SELF, "在职员工证书");
            descrMap.put(PartTime, "挂靠证书");
            descrMap.put(FRIEND, "非在职员工证书");
        }

        public static String getDescr(int subType) {
            return descrMap.getOrDefault(subType, "未知");
        }
    }


    /**
     * 0：Disable ；1：Enable
     */
    public static class CommonStatus {

        /**
         * 删除
         */
        public static final int DELETED = -1;

        /**
         * 禁用
         */
        public static final int DISABLE = 0;

        /**
         * 可用
         */
        public static final int ENABLE = 1;


        /**
         * The Constant descrMap.
         */
        static final Map<Integer, String> descrMap = new HashMap<>();

        static {
            descrMap.put(DISABLE, "禁用");
            descrMap.put(ENABLE, "可用");
            descrMap.put(DELETED, "已删除");
        }

        public static String getDescr(int status) {
            return descrMap.getOrDefault(status, "未知");
        }
    }


    /**
     * 证书状态
     */
    public static class CertificateStatus {

        /**
         * 删除
         */
        public static final int DELETE = -1;

        /**
         * 空闲
         */
        public static final int NO_USE = 0;

        /**
         * 挂出
         */
        public static final int BORROW_OUT = 1;

        /**
         * 挂还
         */
        public static final int BORROW_IN_RETURN = 2;

        /**
         * 挂入
         */
        public static final int BORROW_IN = 3;

        /**
         * 投标
         */
        public static final int BID_USED = 21;

        /**
         * 项目
         */
        public static final int PROJECT_USED = 22;

        /**
         * 中标
         */
        public static final int BID_SUCCESS = 23;

        /**
         * 其他
         */
        public static final int OTHER_STATUS = 24;


        /**
         * The Constant descrMap.
         */
        static final Map<Integer, String> descrMap = new HashMap<>();

        static {
            descrMap.put(DELETE, "删除");
            descrMap.put(NO_USE, "空闲");
            descrMap.put(BORROW_OUT, "挂出");
            descrMap.put(BORROW_IN_RETURN, "挂还");
            descrMap.put(BORROW_IN, "挂入");
            descrMap.put(BID_USED, "投标");
            descrMap.put(PROJECT_USED, "项目");
            descrMap.put(BID_SUCCESS, "中标");
            descrMap.put(OTHER_STATUS, "其他");
        }

        public static final int[] EXCEPT_DELETE = new int[]{NO_USE, BORROW_OUT, BORROW_IN_RETURN, BORROW_IN, BID_USED, PROJECT_USED, BID_SUCCESS, OTHER_STATUS};

        public static String getDescr(int subType) {
            return descrMap.getOrDefault(subType, "未知");
        }
    }


    public static class EmployeeInfoType {

        /**
         * 其他人
         */
        public static final int OTHER = 0;

        /**
         * 租户管理员(企业法人)
         */
        public static final int TENANT_ADMIN = 21;

        /**
         * 租户联系人
         */
        public static final int TENANT_CONTANT = 22;

        /**
         * 租户员工
         */
        public static final int TENANT_Employee = 23;


        /**
         * The Constant descrMap.
         */
        static final Map<Integer, String> descrMap = new HashMap<>();

        static {
            descrMap.put(OTHER, "其他人");
            descrMap.put(TENANT_ADMIN, "租户管理员");
            descrMap.put(TENANT_CONTANT, "租户联系人");
            descrMap.put(TENANT_Employee, "租户员工");
        }

        public static String getDescr(int subType) {
            return descrMap.getOrDefault(subType, "未知");
        }
    }


    /**
     * 用户类型 0:系统用户;1:个人用户;2:企业用户;3:企业VIP用户
     */
    public static class UserInfoType {

        /**
         * 系统超级用户
         */
        public static final int SYSTEM_USER = 0;

        /**
         * 系统管理员
         */
        public static final int ADMIN = 1;

        /**
         * 租户管理员(企业法人)
         */
        public static final int TENANT_ADMIN = 21;

        /**
         * 租户联系人
         */
        public static final int TENANT_CONTANT = 22;

        /**
         * 租户其他用户
         */
        public static final int TENANT_OTHER = 23;


        /**
         * The Constant descrMap.
         */
        static final Map<Integer, String> descrMap = new HashMap<>();

        static {
            descrMap.put(SYSTEM_USER, "系统用户");
            descrMap.put(ADMIN, "系统管理员");
            descrMap.put(TENANT_ADMIN, "租户管理员");
            descrMap.put(TENANT_CONTANT, "租户联系人");
            descrMap.put(TENANT_OTHER, "租户其他人");
        }

        public static String getDescr(int subType) {
            return descrMap.getOrDefault(subType, "未知");
        }
    }


    /**
     * 借入类型
     */
    public static class BorrowCandidatesSources {

        /**
         * 个人
         */
        public static final int PERSON = 1;

        /**
         * 企业
         */
        public static final int ORG = 2;


        /**
         * The Constant descrMap.
         */
        static final Map<Integer, String> descrMap = new HashMap<>();

        static {
            descrMap.put(PERSON, "个人");
            descrMap.put(ORG, "企业");
        }

        public static String getDescr(int type) {
            return descrMap.getOrDefault(type, "未知");
        }
    }


    /**
     * 0: 未知; 1：COMPANY; 2：ORG
     */
    public static class EmployeeInfoCandidatesSources {

        /**
         * 在职员工
         */
        public static final int SELF = 1;

        /**
         * 在职员工管理员
         */
        public static final int ADMIN = 10;


        /**
         * 在职员工联系员
         */
        public static final int CONTACT = 11;


        /**
         * 挂入
         */
        public static final int BORROW = 2;

        /**
         * 非在职员工
         */
        public static final int FRIEND = 3;


        /**
         * The Constant descrMap.
         */
        static final Map<Integer, String> descrMap = new HashMap<>();

        static {
            descrMap.put(SELF, "在职员工");
            descrMap.put(BORROW, "挂入");
            descrMap.put(FRIEND, "非在职员工");
        }

        public static String getDescr(int type) {
            return descrMap.getOrDefault(type, "未知");
        }
    }

    /**
     * 11挂入,12挂还,21挂出,22收回,3借出,30还回
     */
    public static class CertiTransactionInfoType {

        /**
         * 11挂入
         */
        public static final int BorrowIn = 11;

        /**
         * 12挂还
         */
        public static final int BorrowIn_Return = 12;

        /**
         * 21挂出
         */
        public static final int BorrowOut = 21;

        /**
         * 22收回
         */
        public static final int BorrowOut_Return = 22;

        /**
         * 3借出
         */
        public static final int Transaction = 3;

        /**
         * 30还回
         */
        public static final int Transaction_Return = 30;


        static final Map<Integer, String> descrMap = new HashMap<>();

        static {
            descrMap.put(BorrowIn, "挂入");
            descrMap.put(BorrowIn_Return, "归还");
            descrMap.put(BorrowOut, "挂出");
            descrMap.put(BorrowOut_Return, "收回");
            descrMap.put(Transaction, "借出");
            descrMap.put(Transaction_Return, "还回");
        }

        public static String getDescr(int subType) {
            return descrMap.getOrDefault(subType, "未知");
        }
    }

    /**
     * 证书流转记录记录状态
     */
    public enum CertiTransactionStatusTags {
        IN_PROGRESS(0, "进行中"),
        COMPLETE(1, "已完成"),
        ;

        private Integer tag;
        private String value;

        CertiTransactionStatusTags(Integer tag, String value) {
            this.tag = tag;
            this.value = value;
        }

        public Integer getTag() {
            return tag;
        }

        public String getValue() {
            return value;
        }
    }

    public static class QRCodeRecognizeParam {

        public static final String URL = "https://qrcode-bucket-1303877995.cos.ap-shanghai.myqcloud.com/QRCode.jpg";

        public static final String HOST = "qrcode-bucket-1303877995.cos.ap-shanghai.myqcloud.com";

        public static final String AUTHORIZATION = "q-sign-algorithm=sha1&q-ak=AKID4sQBDyVcXHkwqoLv3E9n9oDLGelCoHtZ&q-sign-time=1602485665;1999999999&q-key-time=1602485665;1999999999&q-header-list=&q-url-param-list=&q-signature=57b7cc164a8bbd7529a743bd5c32fb43200f6d6b";

        public static final String PIC_OPERATIONS = "{\"is_pic_info\":1,\"rules\":[{\"fileid\":\"demo.jpg\",\"rule\":\" QRcode/cover/1\"}]}";
    }

    public static class QRCodeRecognizeUrlType {

        public static final String ZJ_GOV_WEB = "app.zjzwfw.gov.cn";

        public static final String WATER_RESOURCE_THREE_WEB = "aqpx.chhsn.com";

        public static final String TRANSPORT_THREE_WEB = "219.143.235.78:8080";

        public static final String NATION_CERTIFICATE_WEB = "www.zyzgzs.cn/c.jsp";
    }

    public static class CertificatePIdType {

        public static final String ZC = "conf_certificate_type_zc";

        public static final String ZCR = "conf_certificate_type_zcr";

        public static final String SL = "conf_certificate_type_sl";

        public static final String XC = "conf_certificate_type_xc";

        public static final String JS = "conf_certificate_type_js";

        public static final String TZ = "conf_certificate_type_tz";

        public static final String QT = "conf_certificate_type_qt";
    }

    public static class QualificationLevels {

        /**
         * 特级
         */
        public static final int SPECIAL = 0;

        /**
         * 壹级
         */
        public static final int FIRST = 1;

        /**
         * 贰级
         */
        public static final int SECOND = 2;


        /**
         * 叁级
         */
        public static final int THIRD = 3;

        /**
         * 不分等级
         */
        public static final int NO_CLASS = 4;

        /**
         * 总承包分级
         */
        public static final String GENERAL_CONTRACTING = "总承包";


        /**
         * 专业承包
         */
        public static final String PROFESSION_CONTRACTING = "专业承包";


        /**
         * 劳务分包分级
         */
        public static final String LABOR_SUBCONTRACT = "劳务分包";


        /**
         * The Constant descrMap.
         */
        public static final Map<Integer, String> descrMap = new HashMap<>();

        public static final List<Integer> GENERAL_CONTRACTING_LEVELS = new ArrayList<>();

        public static final List<Integer> PROFESSION_CONTRACTING_LEVELS = new ArrayList<>();

        public static final List<Integer> LABOR_SUBCONTRACT_LEVELS = new ArrayList<>();

        static {
            descrMap.put(SPECIAL, "特级");
            descrMap.put(FIRST, "壹级");
            descrMap.put(SECOND, "贰级");
            descrMap.put(THIRD, "叁级");
            descrMap.put(NO_CLASS, "不分等级");
        }

        static {
            GENERAL_CONTRACTING_LEVELS.add(SPECIAL);
            GENERAL_CONTRACTING_LEVELS.add(FIRST);
            GENERAL_CONTRACTING_LEVELS.add(SECOND);
            GENERAL_CONTRACTING_LEVELS.add(THIRD);
        }

        static {
            PROFESSION_CONTRACTING_LEVELS.add(FIRST);
            PROFESSION_CONTRACTING_LEVELS.add(SECOND);
            PROFESSION_CONTRACTING_LEVELS.add(THIRD);
        }

        static {
            LABOR_SUBCONTRACT_LEVELS.add(NO_CLASS);
        }

        public static List<Integer> getLevels(String subType) {
            if (subType.contains(GENERAL_CONTRACTING)) {
                return GENERAL_CONTRACTING_LEVELS;
            }
            if (subType.contains(PROFESSION_CONTRACTING)) {
                return PROFESSION_CONTRACTING_LEVELS;
            } else {
                return LABOR_SUBCONTRACT_LEVELS;
            }
        }

        public static String getDescr(int subType) {
            return descrMap.getOrDefault(subType, "未知");
        }
    }

    public static class Gender {

        public static final int MALE = 1;

        public static final int FEMALE = 2;

    }

    public static class HonorLevels {

        public static final int NATIONAL = 1;

        public static final int PROVINCIAL = 2;

        public static final int MUNICIPAL = 3;

        public static final int OTHER = 4;
    }

    public static class CertificateBalanceType {

        //录入
        public static final int INPUT = 1;

        //挂入
        public static final int BORROW_IN = 2;

        //挂出
        public static final int BORROW_OUT = 3;

        //延期
        public static final int RENEWAL = 4;

    }

    public static class NewQualificationLevels {

        /**
         * 特级
         */
        public static final int SPECIAL = 0;

        /**
         * 壹级
         */
        public static final int FIRST = 1;

        /**
         * 贰级
         */
        public static final int SECOND = 2;


        /**
         * 叁级
         */
        public static final int THIRD = 3;

        /**
         * 不分等级
         */
        public static final int NO_CLASS = 4;

        /**
         * 总承包分级
         */
        public static final String GENERAL_CONTRACTING = "总承包";


        /**
         * 专业承包
         */
        public static final String PROFESSION_CONTRACTING = "专业承包";


        /**
         * 劳务分包分级
         */
        public static final String LABOR_SUBCONTRACT = "劳务分包";


        /**
         * The Constant descrMap.
         */
        public static final Map<Integer, String> descrMap = new HashMap<>();

        public static final Map<Integer, String> GENERAL_CONTRACTING_LEVELS = new HashMap<>();

        public static final Map<Integer, String> PROFESSION_CONTRACTING_LEVELS = new HashMap<>();

        public static final Map<Integer, String> LABOR_SUBCONTRACT_LEVELS = new HashMap<>();

        static {
            descrMap.put(SPECIAL, "特级");
            descrMap.put(FIRST, "一级");
            descrMap.put(SECOND, "二级");
            descrMap.put(THIRD, "三级");
            descrMap.put(NO_CLASS, "不分等级");
        }

        static {
            GENERAL_CONTRACTING_LEVELS.put(SPECIAL, "特级");
            GENERAL_CONTRACTING_LEVELS.put(FIRST, "一级");
            GENERAL_CONTRACTING_LEVELS.put(SECOND, "二级");
            GENERAL_CONTRACTING_LEVELS.put(THIRD, "三级");
        }

        static {
            PROFESSION_CONTRACTING_LEVELS.put(FIRST, "一级");
            PROFESSION_CONTRACTING_LEVELS.put(SECOND, "二级");
            PROFESSION_CONTRACTING_LEVELS.put(THIRD, "三级");
        }

        static {
            LABOR_SUBCONTRACT_LEVELS.put(NO_CLASS, "不分等级");
        }

        public static Map<Integer, String> getLevels(String subType) {
            if (subType.contains(GENERAL_CONTRACTING)) {
                return GENERAL_CONTRACTING_LEVELS;
            }
            if (subType.contains(PROFESSION_CONTRACTING)) {
                return PROFESSION_CONTRACTING_LEVELS;
            } else {
                return LABOR_SUBCONTRACT_LEVELS;
            }
        }

        public static String getDescr(int subType) {
            return descrMap.getOrDefault(subType, "未知");
        }
    }
}
